﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace YTSK.FrmKP
{
    /// <summary>
    /// 分销单开票
    /// </summary>
    public partial class FrmFXD : Form
    {
        public Vouch.VouchToolBar voudefine;
        public FrmFXD()
        {
            InitializeComponent();
            this.Icon = YTSK.Properties.Resources.Fly;
            voudefine = new Vouch.VouchToolBar("Rdrecord11", this.groupBox1,this.toolStrip1,"分销");
            voudefine.Init();
            foreach (ToolStripItem bar in this.toolStrip1.Items)
            {
                if (bar.Text.Length > 0)
                { bar.Click += toolbar_click; }
            }
            Application.DoEvents();
        }

        #region 工具栏事件
        private void toolbar_click(object sender, EventArgs e)
        {
            if (sender.GetType() != typeof(ToolStripButton)) { return; }
            var bt = (ToolStripButton)sender;
            var text = bt.Text;
            toolbar_click(text);
        }
        public void toolbar_click(string text)
        {
            voudefine._dg.LeftEdit();
            switch (text)
            {
                case "九机分销":
                case "金立分销":
                case "3C分销":
                    voudefine.DownloadData(text,"");
                    break;
                case "删行":
                    voudefine.DelRow();
                    break;
                case "拆行":
                    voudefine.Spin();
                    break;
                case "修改":
                    voudefine.Modify_RD();
                    break;
                case "保存":
                    voudefine.SaveVouch_RD();
                    break;
                case "放弃":
                    voudefine.Cancel_Rd();
                    break;
                case "审核":
                    voudefine.Verify_Rd();
                    break;
                case "弃审":
                    voudefine.UnVerify_Rd();
                    break;
                case "税控开票":
                    voudefine.VouchToFP_Rd(this);
                    break;
                case "拆单开票":
                    Vouch.VouchToolBar.CDKP(voudefine._id);
                    break;
                case "退出":
                    this.Close();
                    break;
            }
        }
        #endregion 

    }
}
